package projects.myDvdCollection.pageObjects;

import projects.myDvdCollection.pageObjects.elements.IndexPageElements;
import fw.ApplicationManager;

public class IndexPage extends IndexPageElements {

	public IndexPage(ApplicationManager app) {
		super(app);
	}

	public SearchPage login(String login, String pass) {
		if (!isLoggedIn()) {
			app.webElement().type(txtLogin(), login);
			app.webElement().type(txtPass(), pass);
			app.webElement().click(btnLogin());
		}
		return searchPage();
	}

	public boolean isLoggedIn() {
		return !app.webElement().isElementPresent(txtLogin());
	}

}
